//
// Copyright (C) 2004-2010  Autodesk, Inc.
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
// General Public License as published by the Free Software Foundation.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


#ifndef FDOWCSGRIDCRS_H
#define FDOWCSGRIDCRS_H

#ifdef _WIN32
#pragma once
#endif // _WIN32

#include "stdafx.h"

class FdoWcsGridCRS : public FdoXmlSaxHandler, public FdoIDisposable
{
    typedef FdoXmlSaxHandler BaseType;

public:
    static FdoWcsGridCRS* Create();

public:
    FDOWCS_API FdoString* GetSRSName() const;
    
    FDOWCS_API FdoString* GetGridBaseCRS() const;
    FDOWCS_API void SetGridBaseCRS(FdoString* value);

    FDOWCS_API FdoString* GetGridType() const;
    FDOWCS_API void SetGridType(FdoString* value);

    FDOWCS_API FdoDoubleArray* GetGridOrigin() const;
    FDOWCS_API void SetGridOrigin(FdoDoubleArray* value);

    FDOWCS_API FdoDoubleArray* GetGridOffsets() const;
    FDOWCS_API void SetGridOffsets(FdoDoubleArray* value);

    FDOWCS_API FdoString* GetGridCS() const;
    FDOWCS_API void SetGridCS(FdoString* value);

    FDOWCS_API FdoString* GetId() const;

    void InitFromXml(FdoXmlSaxContext* context, FdoXmlAttributeCollection* attrs);
    virtual FdoXmlSaxHandler* XmlStartElement(
        FdoXmlSaxContext* context, 
        FdoString* uri, 
        FdoString* name, 
        FdoString* qname, 
        FdoXmlAttributeCollection* atts
        );
    FdoBoolean XmlEndElement(FdoXmlSaxContext* context, FdoString* uri, FdoString* name, FdoString* qname);

protected:
    FdoWcsGridCRS(void);
    virtual ~FdoWcsGridCRS(void);
    void Dispose();

private:
    // Name or identifier of this GridCRS.
    // It's needed when this GridCRS can be referenced.
    FdoStringP                    mSRSName;
    // Reference to definition of base CRS used by GridCRS.
    FdoStringP                    mGridBaseCRS;
    // Reference to definition of operation method that specifies quadrilateral grid in GridBaseCRS.
    // Default is "urn:ogc:def:method:WCS:1.1:2dSimpleGrid"
    FdoStringP                    mGridType;
    // Position coordinates of origin of this GridCRS in the GridBaseCRS.
    // Default is "0,0"
    FdoDoubleArray*               mGridOrigin;
    // Position offsets between adjacent points in rectangular grid, in each dimension of GridCS
    // in each dimension of GridBaseCRS.
    FdoDoubleArray*               mGridOffsets;
    // Reference to definition of 2D or 3D Cartesian CS used by this GridCRS.
    // Default is "urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS"
    FdoStringP                    mGridCS;
    // The optional Id.
    FdoStringP                    mId;
    
    FdoXmlCharDataHandlerP        mXmlContentHandler;
};

typedef FdoPtr<FdoWcsGridCRS>     FdoWcsGridCRSP;

#endif // FDOWCSGRIDCRS_H